Conversation
- 在设置中新增“隐藏歌词”选项,允许用户仅显示歌曲名称和歌手。 - 更新任务栏配置接口以支持该功能,并设置默认值为 false。 - 修改任务栏歌词组件以根据用户设置决定是否显示歌词内容。
新增任务栏歌词强制重载按钮,用于修复显示异常问题。当任务栏歌词出现显示问题时,用户可通过设置中的"强制重载"按钮关闭并重新创建歌词窗口。
- 新增悬浮锁定模式开关,开启时鼠标穿透窗口,关闭时可拖动窗口 - 在任务栏歌词设置中添加锁定模式配置项 - 通过 IPC 通信实现前端与主进程的鼠标穿透状态同步
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求主要针对任务栏歌词功能进行了多项用户体验优化。通过引入浮动窗口的锁定模式,提升了交互的灵活性和便利性;新增的隐藏歌词选项,满足了用户对界面简洁性的需求;而强制重载功能则为解决潜在的显示问题提供了快速有效的解决方案,整体增强了任务栏歌词的可用性和稳定性。 Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
该 PR 对“任务栏歌词/悬浮歌词”做了功能微调:新增悬浮窗口锁定(鼠标穿透)能力、支持隐藏歌词仅显示歌曲信息,并提供“强制重载窗口”用于修复显示异常。
Changes:
- 新增悬浮锁定模式(鼠标穿透/不可拖动),并通过 IPC 下发到主进程窗口层生效
- 新增“隐藏歌词,仅显示歌名和歌手”显示选项
- 新增“强制重载”按钮与 IPC 通道,用于关闭并重新创建歌词窗口
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/views/TaskbarLyric/index.vue | 渲染端支持 hideLyrics;悬浮模式下同步 floatingLock 到主进程以切换鼠标穿透 |
| src/types/shared/taskbar-ipc.ts | 扩展 TaskbarConfig(floatingLock/hideLyrics)与新增 FORCE_RELOAD IPC 常量 |
| src/components/Setting/config/lyric.ts | 设置项新增锁定模式、隐藏歌词、强制重载按钮 |
| electron/main/windows/taskbar-lyric-window.ts | 为任务栏歌词窗口补充 setMousePassthrough 以支持统一调用 |
| electron/main/windows/floating-taskbar-lyric-window.ts | 悬浮窗口根据 store 配置应用 floatingLock,并提供 setMousePassthrough |
| electron/main/utils/taskbar-lyric-manager.ts | manager 增加 setMousePassthrough 透传到当前活动窗口 |
| electron/main/ipc/ipc-taskbar.ts | 新增 set-ignore-mouse-events 监听与 FORCE_RELOAD 重载逻辑 |
| // 强制重载歌词窗口 | ||
| ipcMain.on(TASKBAR_IPC_CHANNELS.FORCE_RELOAD, () => { | ||
| const currentConfig = getTaskbarConfig(); | ||
| if (!currentConfig.enabled) return; | ||
| taskbarLyricManager.close(false); | ||
| setTimeout(() => { | ||
| taskbarLyricManager.create(currentConfig.mode); | ||
| updateWindowVisibility(currentConfig); | ||
| }, 500); | ||
| }); |
There was a problem hiding this comment.
FORCE_RELOAD 通过 close(false) 后延时 500ms 再 create(),但两个 window 的 create() 都会在 win 尚未销毁时直接复用并 show() 现有窗口。这样在窗口关闭流程超过 500ms(或事件循环繁忙)时,可能无法真正“重载”窗口。建议在重建前明确等待旧窗口触发 closed/销毁(或在 close 时将引用置空/提供 destroy+recreate 的专用方法),以保证强制重载的确定性。
There was a problem hiding this comment.
Code Review
This PR fine-tunes the taskbar lyric feature, adding lock mode, hide lyrics, and forced reload functionalities. However, critical security vulnerabilities were identified due to insecure Electron window configurations, which could lead to Remote Code Execution if a renderer is compromised. It is highly recommended to adopt Electron security best practices, such as disabling nodeIntegration, enabling contextIsolation, and using the sandbox for all renderer windows. Additionally, the code could benefit from improvements in redundancy and logical consistency.
| public setMousePassthrough(ignore: boolean) { | ||
| if (!this.win || this.win.isDestroyed()) return; | ||
| if (ignore) { | ||
| this.win.setIgnoreMouseEvents(true, { forward: true }); | ||
| } else { | ||
| this.win.setIgnoreMouseEvents(false); | ||
| } | ||
| } |
| value: computed({ | ||
| get: () => taskbarLyricConfig.floatingLock, | ||
| set: (v) => { | ||
| taskbarLyricConfig.floatingLock = v ?? true; |
There was a problem hiding this comment.
这里的默认值不一致。在 DEFAULT_TASKBAR_CONFIG 中,floatingLock 的默认值是 false。然而,这里的 setter 在 v 为 null 或 undefined 时回退到了 true。这与另一个新设置 hideLyrics 的 v ?? false 行为不一致,后者与其默认值 false 保持了一致。为了保持代码的一致性,建议将 v ?? true 修改为 v ?? false。
| taskbarLyricConfig.floatingLock = v ?? true; | |
| taskbarLyricConfig.floatingLock = v ?? false; |
| setMousePassthrough(taskbarConfig.floatingLock); | ||
| watch( | ||
| () => taskbarConfig.floatingLock, | ||
| (v) => setMousePassthrough(v), | ||
| { immediate: true }, | ||
| ); |
There was a problem hiding this comment.
| margin: 5px 0; | ||
| padding: 0 0.9em; | ||
| box-sizing: border-box; | ||
| position: relative; |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
No description provided.